<template>
	<view>
		<button class="login_btn" :class="{'loading': isLoadingS}" @tap="loginClickS">
			<text v-if="!isLoadingS">{{titleS}}</text>
			<image v-else class="loading_image" src="@/static/image/loading.png" mode="aspectFill"></image>
		</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		props:['isLoadingS','titleS'],
		methods:{
			loginClickS() {
				this.$emit('loginClickS')
			}
		}
	}
</script>

<style scoped lang="scss">
	.login_btn {
		width: 600rpx;
		height: 100rpx;
		margin-top: 40rpx;
		line-height: 100rpx;
		text-align: center;
		outline: none;
		color: #fff;
		border-radius: 50rpx;
		
		background-color: $themeColor;
		transition: width 1s;

		.loading_image {
			transform-origin: center center;
			transform: rotate(0deg);
			width: 30rpx;
			height: 30rpx;
			animation: loadingImage 0.5s infinite;
		}

		&.loading {
			animation: changeBtnWidth 0.5s forwards;
		}
	}
	
	@keyframes changeBtnWidth {
		from {
			width: 600rpx;
		}
	
		to {
			width: 100rpx;
		}
	}
	
	@keyframes loadingImage {
		from {
			transform: rotate(0deg);
		}
	
		to {
			transform: rotate(360deg);
		}
	}
</style>
